let plugindDefs = {
  PC: {},
  APP: {}
}
let interactionTypeCnMap = {
  layout: '布局组件',
  input: '表单组件',
  combination: '交互组件',
  meta: '展示组件'

  // display: '展示组件',
  // function: '功能组件',
  // other: '其他组件'
}
let interactionTypeOrderMap = {
  layout: 0,
  input: 1,
  combination: 2,
  meta: 3
}

function importAll(r) {
  r.keys().forEach(key => {
    // if(key.indexOf('childPage') > 0 || key.indexOf('richTextEditor') > 0) return
    // let match = key.match(/^\.\/([^\/(\/|\\\\)]*)\/([^\/(\/|\\\\)]*)\/index\.js$/)
    let match = key.match(/^\.\/([^\/(\/|\\\\)]*)\/([^\/(\/|\\\\)]*)\/(APP|PC)\/index\.js$/)
    // plugindDefs[match[2]] = r(key).default
    plugindDefs[match[3]][match[2]] = r(key).default
    r(key).default.interactionTypeCn = interactionTypeCnMap[match[1]]
    r(key).default.category = match[1]
    r(key).default.interactionTypeOrder = interactionTypeOrderMap[match[1]]
    r(key).default.name = match[2]
    r(key).default.device = match[3]
  })
}

// require.context 不能用变量
importAll(require.context('./', true, /^\.\/([^\/(\/|\\\\)]*)\/([^\/(\/|\\\\)]*)\/(APP|PC)\/index\.js$/))

export default plugindDefs
